<template>
<div>
    <input @blur="btnShow" ref="inpRef" v-if="flag" type="text" name="" id="">
    <button v-else @click="inpShow">显示输入框</button>
</div>
    
</template>

<script>
export default {
data(){
    return{
        flag:false
    }
},
methods:{
    inpShow(){
        this.flag=true
        this.$nextTick(()=>{
            this.$refs.inpRef.focus()
        })
    },
    btnShow(){
        this.flag=false
    }
}
}
</script>

<style>

</style>